﻿<%if not in_sdcms then response.write("template load fail"):response.end() end if%><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="Keywords" content="{sdcms[seokey]}" />
<meta name="Description" content="{sdcms[seodesc]}" />
<title>忘记密码_{sdcms[webname]} - powered by sdcms</title>
<link href="{webroot}lib/css/base.css" rel="stylesheet" type="text/css" />
<link href="{webroot}theme/default/css/public.css" rel="stylesheet" type="text/css" />
<link href="{webroot}theme/default/css/user_base.css" rel="stylesheet" type="text/css" />
<link href="{webroot}theme/default/css/user_reg.css" rel="stylesheet" type="text/css" />
<link href="{webroot}theme/default/css/user_bind.css" rel="stylesheet" type="text/css" />
<script>var webroot="{webroot}";</script>
<script src="{webroot}lib/js/jquery.js"></script>
<script src="{webroot}lib/js/jquery-migrate-1.1.0.min.js"></script>
<script src="{webroot}lib/tips/jquery.tips.js"></script>
<script src="{webroot}lib/js/base.js"></script>
<script src="{webroot}lib/js/mobile.js"></script>
<script src="{webroot}lib/validator/jquery.validator.js"></script>
<script src="{webroot}lib/validator/zh_CN.js"></script>
<script src="{webroot}theme/default/js/sdcms.js"></script>
{if sdcms.getsys("mailtype")<>""}
{if u=0}
<script>
$(function(){
	$(".form_getpass").validator(
	{
		stopOnError:true,
		theme:'yellow_right_effect',
		ignore:':hidden',
		beforeSubmit:function(){$("input[type='submit']").attr("disabled",true);},
		valid:function(form)
		{
			$.fn.tips({type:'loading',content:'数据提交中'});
			$.ajax(
			{
				url:"?act=checkpass",
				type:"post",
				data:$(form).serialize(),
				success:function(data){
					data=jQuery.parseJSON(data);
					var type="warn";
					if(data.status=="y"){type="ok";}
					$.fn.tips({type:type,content:data.info});
					if(data.status=="y"){$(".form_getpass")[0].reset();$("input[type='submit']").attr("disabled",false);}
				}
			});
		},
		invalid:function(){$("input[type='submit']").attr("disabled",false);}
	});
})
</script>
{else}
{dim uid:uid=sdcms.enhtml(sdcms.fget("uid",0))}
{dim code:code=sdcms.enhtml(sdcms.fget("code",0))}
<script>
$(function(){
	$(".c_password").blur(function(){
	var value=$(this).val();
	var box=$('#strength');
	if (value==''||value==null){
			box.removeClass().addClass('nothing').text('');
			return false;
		} else if (value.length<6){
			box.removeClass().addClass('nothing').text('密码过短');
		} else {
			var score=passwordGrade(value);
			if (score<11){
				box.removeClass().addClass('nothing').text('不安全');
			} else if (score<21){
				box.removeClass().addClass('strength normal').text('安全程度：低');
			} else if (score<31){
				box.removeClass().addClass('strength general').text('安全程度：中');
			} else if (score>30){
				box.removeClass().addClass('strength special').text('安全程度：高');
			}
		}
	});
	
	$(".form_getpass").validator(
	{
		stopOnError:true,
		theme:'yellow_right_effect',
		ignore:':hidden',
		beforeSubmit:function(){$("input[type='submit']").attr("disabled",true);},
		valid:function(form)
		{
			$.fn.tips({type:'loading',content:'数据提交中'});
			$.ajax(
			{
				url:"?act=checkdb&uid={uid}&code={code}",
				type:"post",
				data:$(form).serialize(),
				success:function(data){
					data=jQuery.parseJSON(data);
					var type="warn";
					if(data.status=="y"){type="ok";}
					$.fn.tips({type:type,content:data.info});
					if(data.status=="y"){setTimeout("location.href='login.asp'",1500);}
				}
			});
		},
		invalid:function(){$("input[type='submit']").attr("disabled",false);}
	});
})
</script>
{/if}
{/if}
</head>

<body>
    {sdcms:include("../sdcms_head.asp")}
    
    <div id="position">您所在的位置：<a href="{webroot}">首页</a> > <a href="?">忘记密码</a></div>
    <div class="w980 mt10 mc">
        <div class="w900 bt">
            <ul class="bind_menu">
                <li class="hover">忘记密码</li>
            </ul>
            <div class="c block">
                <div class="p10"></div>
                {if sdcms.getsys("mailtype")=""}
                系统未开启邮件设置，请联系管理员找回密码
                {else}
               {if u=0}
               <form class="form_getpass" method="post">
               <ul id="reg">
                   <li><em>电子邮箱：</em><input type="text" name="emailpass" class="ip w01" maxlength="20" data-rule="电子邮箱:required;email;remote[ajax.asp?act=emailpass];" /></li>
                   <li><em>验证码：</em><input type="text" name="imgcode" class="ip w02" maxlength="4" data-rule="验证码:required;remote[ajax.asp?act=imgcode];" /> <img src="{webroot}lib/imgcode.asp?t0=80&t1=20" title="看不清楚？点击刷新！" align="absmiddle" id="imgcode" onClick="this.src+='&'+Math.random();" /><span for="imgcode" class="msg-box"></span></li>
                   <dd><input type="submit" value="找回密码" class="bnt_blue" /></dd>
               </ul>
               </form>
               {else}
               {sdcms:rs top="1" table="sd_user" where="email='[uid]' and somecode='[code]'"}
               {rs:eof}重设密码链接已失效，请重新申请{/rs:eof}
               <form class="form_getpass" method="post">
               <ul id="reg">
                   <li><em>用户名：</em>{$rs[username]}</li>
                   <li><em>新密码：</em><input type="password" name="password" class="ip w01" maxlength="16" data-rule="新密码:required;username;remote[ajax.asp?act=password];" /></li>
                   <dd><div id="strength"></div></dd>
                   <li><em>确认密码：</em><input type="password" name="repass" class="ip w01" maxlength="16"data-rule="确认密码:required;password;match(password);remote[ajax.asp?act=repass, password];" /></li>
                   <dd><input type="submit" value="重置密码" class="bnt_blue" /></dd>
               </ul>
               </form>
               {/sdcms:rs}
               {/if}
               {/if}   
                
            </div>
        </div>
    </div>
    {sdcms:include("../sdcms_foot.asp")}